import { axios } from "@/utils/request";
// 获取服务人员详情
export const getServicePersonById = (id: number) => {
  return axios({
    url: `/customers/${id}`,
    method: "get",
  });
};

//接单
export const takeServiceOrder = (demandId: number, servicePersonId: number) => {
  return axios({
    url: `/demand/demands/${demandId}/accept`,
    method: "post",
    data: servicePersonId,
  });
};
// 取消接单
export const cancelServiceOrder = (params: { orderId: number }) => {
  return axios({
    url: "/api/service/cancelOrder",
    method: "get",
    params,
  });
};
// 获取服务人员订单
export const getServicePersonOrders = (servicePersonId: number) => {
  return axios({
    url: `/orders/service-person/${servicePersonId}`,
    method: "get",
  });
};

// 开始服务
export const startservice = (orderId: string) => {
  return axios({
    url: `/orders/start-service?businessOrderId=${orderId}`,
    method: "post",
  });
};
// 完成服务
export const finishservice = (orderId: string) => {
  return axios({
    url: `/orders/finish-service?businessOrderId=${orderId}`,
    method: "post",
  });
};
// 获取历史投诉
export const getserComplaintHistory = (servicepersonId: number) => {
  return axios({
    url: `/complaints/by-service-person/${servicepersonId}`,
    method: "get",
  });
};
